<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script src="js/jquery-2.1.1.min.js"></script>
<script>
	function getOpenid(){
		$('#openid').append(location.href);
		var code = location.href.split('?')[1].split('&')[0].split('=')[1];
		$('#openid').append(code);
		$.ajax({
			url:"https://api.weixin.qq.com/sns/oauth2/access_token?appid=wx759e6da18b169ee9&secret=9d022188d60983d15645c1b89d1b2f7e&code="+code+"&grant_type=authorization_code",
			resultType:'json',
			success:function(json){
				alert(json.openid);
				$('#openid').append(json.openid);
			}
		})
	}
</script>
</head>
<body>
<script>
	getOpenid();
</script>
<h1 id="openid"></h1>
</body>
</html>